package org.study.influxdb.api.util;

import com.influxdb.client.InfluxDBClient;
import com.influxdb.client.InfluxDBClientFactory;

/**
 * InfluxDB数据库连接操作类
 *
 * @author LENOVO
 */
public class InfluxDBConnection {
    private String username = "admin";
    private String password = "influxdb";
    /**
     * You can generate an API token from the "API Tokens Tab" in the UI
     * String token = System.getenv("INFLUX_TOKEN");
     */
    private static String token = "GOMr8nGAoJGInutTIeMR_txF4F1ilbAu41H6tUE9P91J14UQPyeXCjfjx10iqDxgnUzOYe1pqrHHRUETirY2pQ==";
    private static String url = "http://127.0.0.1:8086";
    public static final String org = "influxdb";
    public static final String bucket = "test";

    private InfluxDBConnection() {
    }

    public static InfluxDBClient influxDBClient() {
        InfluxDBClient influxDBClient = InfluxDBClientFactory.create(url, token.toCharArray());
        return influxDBClient;
    }
}
